package com.ruoyi.chatgpt.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.chatgpt.mapper.GptCatalogMapper;
import com.ruoyi.chatgpt.domain.GptCatalog;
import com.ruoyi.chatgpt.service.IGptCatalogService;

/**
 * 目录Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-06-30
 */
@Service
public class GptCatalogServiceImpl implements IGptCatalogService 
{
    @Autowired
    private GptCatalogMapper gptCatalogMapper;

    /**
     * 查询目录
     * 
     * @param id 目录主键
     * @return 目录
     */
    @Override
    public GptCatalog selectGptCatalogById(Long id)
    {
        return gptCatalogMapper.selectGptCatalogById(id);
    }

    /**
     * 查询目录列表
     * 
     * @param gptCatalog 目录
     * @return 目录
     */
    @Override
    public List<GptCatalog> selectGptCatalogList(GptCatalog gptCatalog)
    {
        return gptCatalogMapper.selectGptCatalogList(gptCatalog);
    }

    /**
     * 新增目录
     * 
     * @param gptCatalog 目录
     * @return 结果
     */
    @Override
    public int insertGptCatalog(GptCatalog gptCatalog)
    {
        gptCatalog.setCreateTime(DateUtils.getNowDate());
        return gptCatalogMapper.insertGptCatalog(gptCatalog);
    }

    /**
     * 修改目录
     * 
     * @param gptCatalog 目录
     * @return 结果
     */
    @Override
    public int updateGptCatalog(GptCatalog gptCatalog)
    {
        gptCatalog.setUpdateTime(DateUtils.getNowDate());
        return gptCatalogMapper.updateGptCatalog(gptCatalog);
    }

    /**
     * 批量删除目录
     * 
     * @param ids 需要删除的目录主键
     * @return 结果
     */
    @Override
    public int deleteGptCatalogByIds(Long[] ids)
    {
        return gptCatalogMapper.deleteGptCatalogByIds(ids);
    }

    /**
     * 删除目录信息
     * 
     * @param id 目录主键
     * @return 结果
     */
    @Override
    public int deleteGptCatalogById(Long id)
    {
        return gptCatalogMapper.deleteGptCatalogById(id);
    }

    @Override
    public List<GptCatalog> queryRootGptCatalog() {
        return gptCatalogMapper.queryRootGptCatalog();
    }

    @Override
    public List<GptCatalog> queryGptCatalogList(Long catalogId) {
        return gptCatalogMapper.queryGptCatalogList(catalogId);
    }
}
